package com;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet(name = "delectServlet")
public class delectServlet extends HttpServlet {
    //af
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("post");
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("get");
        response.setContentType("text/html;charset=utf-8");
        PrintWriter out=response.getWriter();
        Users users=new Users();
        int i=users.delete((request.getParameter("user")));
        if (i==0)
        {
            out.write("用户删除失败！！");
        }
        else
        {
            out.write("用户删除成功！！");
        }
    }
}
